會發生css路徑的問題可能是因為override的部分沒有設定好,所以再重作一個container
借用一下docker hub上比較熱門的image的dockerfile
https://hub.docker.com/r/occitech/cakephp
FROM php:5.6-apache
RUN requirements="libmcrypt-dev g++ libicu-dev libmcrypt4 libicu57" \
&& apt-get update && apt-get install -y $requirements \
&& docker-php-ext-install pdo_mysql \
&& docker-php-ext-install mcrypt \
&& docker-php-ext-install mbstring \
&& docker-php-ext-install intl \
&& docker-php-ext-install pcntl \
&& requirementsToRemove="libmcrypt-dev g++ libicu-dev" \
&& apt-get purge --auto-remove -y $requirementsToRemove \
&& rm -rf /var/lib/apt/lists/*
RUN curl -sSL https://getcomposer.org/installer | php \
&& mv composer.phar /usr/local/bin/composer \
&& apt-get update \
&& apt-get install -y zlib1g-dev git \
&& docker-php-ext-install zip \
&& apt-get purge -y --auto-remove zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*
RUN a2enmod rewrite
RUN usermod -u 1000 www-data
因為安裝cake至少要php7.2以上,所以把FROM php:5.6-apache 改成FROM php:7.4-apache
另外在https://hub.docker.com/_/php php官方的image裡有提到他們提供了安裝extensions的方法: docker-php-ext-install
出現了以下錯誤...推測應該是改php版本造成的
executor failed running
[/bin/sh -c requirements="libmcrypt-dev g++ libicu-dev libmcrypt4 libicu57"
&& apt-get update && apt-get install -y $requirements
&& docker-php-ext-install pdo_mysql && docker-php-ext-install mcrypt && docker-php-ext-install mbstring
&& docker-php-ext-install intl && docker-php-ext-install pcntl && requirementsToRemove="libmcrypt-dev g++ libicu-dev"
&& apt-get purge --auto-remove -y $requirementsToRemove
&& rm -rf /var/lib/apt/lists/*]:
exit code: 100
既然要直接進到dockerfile,明天再試試看其他方法